package com.kevin.data;

import java.sql.Connection;
import java.util.Properties;

import javax.sql.DataSource;

import com.kevin.enums.transaction.TransactionIsolationLevel;
import com.kevin.transaction.Transaction;
import com.kevin.transaction.TransactionFactory;



public class SpringManagedTransactionFactory implements TransactionFactory {

	  /**
	   * {@inheritDoc}
	   */
	  public Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit) {
		  return new SpringManagedTransaction(dataSource);
	  }

	  /**
	   * {@inheritDoc}
	   */
	  public Transaction newTransaction(Connection conn) {
	    throw new UnsupportedOperationException("New Spring transactions require a DataSource");
	  }

	  /**
	   * {@inheritDoc}
	   */
	  public void setProperties(Properties props) {
	    // not needed in this version
	  }

}
